using System.Collections.Generic;
using Sinacor.Servico.Bovespa.Contabil.Service.ServiceContract;
using Sinacor.Infra.Service.Security.Services;

namespace Sinacor.Servico.Bovespa.Contabil.Service.ServiceImplementation
{
    [SinacorServiceBehavior]
    public class DespesaNota : IDespesaNota 
    {
		public void AlterarAjustarDespesaNota(DataContract.Request.DespesaNotaRequest request)
        {
            BusinessLogic.DespesaNota _businessLogic = new Sinacor.Servico.Bovespa.Contabil.BusinessLogic.DespesaNota();
            Translator.DataContractToBusinessEntity.DespesaNota _toBusinessEntity = new Sinacor.Servico.Bovespa.Contabil.Service.ServiceImplementation.Translator.DataContractToBusinessEntity.DespesaNota();
            _businessLogic.AlterarAjustarDespesaNota(_toBusinessEntity.ToDespesaNota(request));
		}

		public void AlterarAjustarDespesasNota(List<DataContract.Request.DespesaNotaRequest> requestList)
        {
            BusinessLogic.DespesaNota _businessLogic = new Sinacor.Servico.Bovespa.Contabil.BusinessLogic.DespesaNota();
            Translator.DataContractToBusinessEntity.DespesaNota _toBusinessEntity = new Sinacor.Servico.Bovespa.Contabil.Service.ServiceImplementation.Translator.DataContractToBusinessEntity.DespesaNota();
            _businessLogic.AlterarAjustarDespesasNota(_toBusinessEntity.ToDespesaNota(requestList));
		}

		public void AlterarDespesaNota(DataContract.Request.DespesaNotaRequest request)
        {
            BusinessLogic.DespesaNota _businessLogic = new Sinacor.Servico.Bovespa.Contabil.BusinessLogic.DespesaNota();
            Translator.DataContractToBusinessEntity.DespesaNota _toBusinessEntity = new Sinacor.Servico.Bovespa.Contabil.Service.ServiceImplementation.Translator.DataContractToBusinessEntity.DespesaNota();
            _businessLogic.AlterarDespesaNota(_toBusinessEntity.ToDespesaNota(request));
		}

		public void AlterarDespesasNota(List<DataContract.Request.DespesaNotaRequest> requestList)
        {
            BusinessLogic.DespesaNota _businessLogic = new Sinacor.Servico.Bovespa.Contabil.BusinessLogic.DespesaNota();
            Translator.DataContractToBusinessEntity.DespesaNota _toBusinessEntity = new Sinacor.Servico.Bovespa.Contabil.Service.ServiceImplementation.Translator.DataContractToBusinessEntity.DespesaNota();
            _businessLogic.AlterarDespesasNota(_toBusinessEntity.ToDespesaNota(requestList));
		}

		public List<DataContract.Response.DespesaNotaResponse> ConsultarDespesasNota(DataContract.Request.FiltroDespesaNotaRequest request)
        {
            BusinessLogic.DespesaNota _businessLogic = new Sinacor.Servico.Bovespa.Contabil.BusinessLogic.DespesaNota();
            Translator.BusinessEntityToDataContract.DespesaNota _toDataContract = new Sinacor.Servico.Bovespa.Contabil.Service.ServiceImplementation.Translator.BusinessEntityToDataContract.DespesaNota();
            Translator.DataContractToBusinessEntity.DespesaNota _toBusinessEntity = new Sinacor.Servico.Bovespa.Contabil.Service.ServiceImplementation.Translator.DataContractToBusinessEntity.DespesaNota();
            return _toDataContract.ToDespesaNotaResponse(_businessLogic.ConsultarDespesasNota(_toBusinessEntity.ToFiltroDespesaNota(request)));
		}

		public void ExcluirDespesaNota(DataContract.Request.FiltroDespesaNotaChaveRequest request)
        {
            BusinessLogic.DespesaNota _businessLogic = new Sinacor.Servico.Bovespa.Contabil.BusinessLogic.DespesaNota();
            Translator.DataContractToBusinessEntity.DespesaNota _toBusinessEntity = new Sinacor.Servico.Bovespa.Contabil.Service.ServiceImplementation.Translator.DataContractToBusinessEntity.DespesaNota();
            _businessLogic.ExcluirDespesaNota(_toBusinessEntity.ToFiltroDespesaNotaChave(request));
		}

		public void ExcluirDespesasNota(List<DataContract.Request.FiltroDespesaNotaChaveRequest> requestList)
        {
            BusinessLogic.DespesaNota _businessLogic = new Sinacor.Servico.Bovespa.Contabil.BusinessLogic.DespesaNota();
            Translator.DataContractToBusinessEntity.DespesaNota _toBusinessEntity = new Sinacor.Servico.Bovespa.Contabil.Service.ServiceImplementation.Translator.DataContractToBusinessEntity.DespesaNota();
            _businessLogic.ExcluirDespesasNota(_toBusinessEntity.ToFiltroDespesaNotaChave(requestList));
        }

		public void ExecutarTransacoesDespesaNota(List<DataContract.Request.FiltroDespesaNotaChaveRequest> exclusaoList, List<DataContract.Request.DespesaNotaRequest> inclusaoList, List<DataContract.Request.DespesaNotaRequest> alteracaoList)
        {
            BusinessLogic.DespesaNota _businessLogic = new Sinacor.Servico.Bovespa.Contabil.BusinessLogic.DespesaNota();
            Translator.DataContractToBusinessEntity.DespesaNota _toBusinessEntity = new Sinacor.Servico.Bovespa.Contabil.Service.ServiceImplementation.Translator.DataContractToBusinessEntity.DespesaNota();

            _businessLogic.ExcluirDespesasNota(_toBusinessEntity.ToFiltroDespesaNotaChave(exclusaoList));
            _businessLogic.IncluirDespesasNota(_toBusinessEntity.ToDespesaNota(inclusaoList));
            _businessLogic.AlterarDespesasNota(_toBusinessEntity.ToDespesaNota(alteracaoList)); 
		}

		public void IncluirAjustarDespesaNota(DataContract.Request.DespesaNotaRequest request)
        {
            BusinessLogic.DespesaNota _businessLogic = new Sinacor.Servico.Bovespa.Contabil.BusinessLogic.DespesaNota();
            Translator.DataContractToBusinessEntity.DespesaNota _toBusinessEntity = new Sinacor.Servico.Bovespa.Contabil.Service.ServiceImplementation.Translator.DataContractToBusinessEntity.DespesaNota();

            _businessLogic.IncluirAjustarDespesaNota(_toBusinessEntity.ToDespesaNota(request));
		}

		public void IncluirAjustarDespesasNota(List<DataContract.Request.DespesaNotaRequest> requestList)
        {
            BusinessLogic.DespesaNota _businessLogic = new Sinacor.Servico.Bovespa.Contabil.BusinessLogic.DespesaNota();
            Translator.DataContractToBusinessEntity.DespesaNota _toBusinessEntity = new Sinacor.Servico.Bovespa.Contabil.Service.ServiceImplementation.Translator.DataContractToBusinessEntity.DespesaNota();

            _businessLogic.IncluirAjustarDespesasNota(_toBusinessEntity.ToDespesaNota(requestList));
		}

		public void IncluirDespesaNota(DataContract.Request.DespesaNotaRequest request)
        {
            BusinessLogic.DespesaNota _businessLogic = new Sinacor.Servico.Bovespa.Contabil.BusinessLogic.DespesaNota();
            Translator.DataContractToBusinessEntity.DespesaNota _toBusinessEntity = new Sinacor.Servico.Bovespa.Contabil.Service.ServiceImplementation.Translator.DataContractToBusinessEntity.DespesaNota();

            _businessLogic.IncluirDespesaNota(_toBusinessEntity.ToDespesaNota(request));
		}

		public void IncluirDespesasNota(List<DataContract.Request.DespesaNotaRequest> requestList)
        {
            BusinessLogic.DespesaNota _businessLogic = new Sinacor.Servico.Bovespa.Contabil.BusinessLogic.DespesaNota();
            Translator.DataContractToBusinessEntity.DespesaNota _toBusinessEntity = new Sinacor.Servico.Bovespa.Contabil.Service.ServiceImplementation.Translator.DataContractToBusinessEntity.DespesaNota();

            _businessLogic.IncluirDespesasNota(_toBusinessEntity.ToDespesaNota(requestList));
		}

		public DataContract.Response.DespesaNotaResponse ObterDespesaNota(DataContract.Request.FiltroDespesaNotaChaveRequest request)
        {
            BusinessLogic.DespesaNota _businessLogic = new Sinacor.Servico.Bovespa.Contabil.BusinessLogic.DespesaNota();
            Translator.DataContractToBusinessEntity.DespesaNota _toBusinessEntity = new Sinacor.Servico.Bovespa.Contabil.Service.ServiceImplementation.Translator.DataContractToBusinessEntity.DespesaNota();
            Translator.BusinessEntityToDataContract.DespesaNota _toDataContract = new Sinacor.Servico.Bovespa.Contabil.Service.ServiceImplementation.Translator.BusinessEntityToDataContract.DespesaNota();

            return _toDataContract.ToDespesaNotaResponse(_businessLogic.ObterDespesaNota(_toBusinessEntity.ToFiltroDespesaNotaChave(request)));
		}

		public DataContract.Response.ConflitoResponse VerificarConflitoPeriodo(DataContract.Request.DespesaNotaRequest request)
        {
            BusinessLogic.DespesaNota _businessLogic = new Sinacor.Servico.Bovespa.Contabil.BusinessLogic.DespesaNota();
            Translator.DataContractToBusinessEntity.DespesaNota _toBusinessEntity = new Sinacor.Servico.Bovespa.Contabil.Service.ServiceImplementation.Translator.DataContractToBusinessEntity.DespesaNota();
            Translator.BusinessEntityToDataContract.Conflito _toDataContract = new Sinacor.Servico.Bovespa.Contabil.Service.ServiceImplementation.Translator.BusinessEntityToDataContract.Conflito();

            return _toDataContract.ToConflitoResponse(_businessLogic.VerificarConflitoPeriodo(_toBusinessEntity.ToDespesaNota(request)));
		}
    }
}
